import 'package:flutter/material.dart';
import 'package:flutter2/colors.dart';
import 'package:flutter2/widget/base/base_container.dart';
import 'package:flutter2/widget/base/normal_text.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class DialogCommon extends StatelessWidget {
  const DialogCommon({
    super.key,
    this.title,
    this.content,
    this.leftText,
    this.rightText,
    this.leftClick,
    this.rightClick,
  });

  final String? title;
  final String? content;
  final String? leftText;
  final String? rightText;
  final GestureTapCallback? leftClick;
  final GestureTapCallback? rightClick;

  @override
  Widget build(BuildContext context) {
    return BaseContainer(
      width: 320.w,
      radius: 10,
      background: Colors.white,
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Padding(
            padding: EdgeInsets.symmetric(vertical: 20),
            child: NormalText(
              fontSize: 15,
              text: title,
              fontColor: mainText2,
              fontWeight: FontWeight.bold,
            ),
          ),
          NormalText(
            text: content,
            fontSize: 15,
          ),
          SizedBox(
            height: 15,
          ),
          Container(
            height: 0.5,
            color: line,
          ),
          IntrinsicHeight(
            child: Row(
              children: [
                Expanded(
                  child: BaseContainer(
                    padding: EdgeInsets.symmetric(vertical: 15),
                    click: leftClick,
                    child: NormalText(
                      fontSize: 16,
                      textAlign: TextAlign.center,
                      text: leftText,
                    ),
                  ),
                ),
                Container(
                  width: 0.5,
                  height: double.infinity,
                  color: line,
                ),
                Expanded(
                  child: BaseContainer(
                    click: rightClick,
                    padding: EdgeInsets.symmetric(vertical: 15),
                    child: NormalText(
                      fontSize: 16,
                      textAlign: TextAlign.center,
                      text: rightText,
                      fontColor: btnColor,
                    ),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
